From 502043358f4111f5fe58bebbb639c001edd87760 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 24 Mar 2005 08:46:03 +0000 Subject: [PATCH] bitkeeper revision 1.1236.42.2 (42427e4bowK4ngPjKLA3967ZsswxjQ) Cleanups. Signed-off-by: Keir Fraser --- .../drivers/xen/console/console.c | 62 +++++++++---------- xen/common/physdev.c | 14 ++--- xen/drivers/char/serial.c | 15 ++--- xen/include/xen/physdev.h | 8 +-- 4 files changed, 43 insertions(+), 56 deletions(-) diff --git a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c index d0948132d7..fb2d1169ab 100644 --- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c +++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c @@ -77,19 +77,18 @@ static int __init xencons_setup(char *str) else if ( !strncmp(str, "off", 3) ) xc_mode = XC_OFF; - switch (xc_mode) + switch ( xc_mode ) { case XC_SERIAL: - n = simple_strtol( str+4, &q, 10 ); - if ( q>str+4 ) xc_num = n; - break; - + n = simple_strtol( str+4, &q, 10 ); + if ( q > (str + 4) ) xc_num = n; + break; case XC_TTY: - n = simple_strtol( str+3, &q, 10 ); - if ( q>str+3 ) xc_num = n; - break; + n = simple_strtol( str+3, &q, 10 ); + if ( q > (str + 3) ) xc_num = n; + break; } -printk("xc_num = %d\n",xc_num); + return 1; } __setup("xencons=", xencons_setup); @@ -148,16 +147,12 @@ static void kcons_write_dom0( { int rc; - while ( count > 0 ) + while ( (count > 0) && + ((rc = HYPERVISOR_console_io( + CONSOLEIO_write, count, (char *)s)) > 0) ) { - if ( (rc = HYPERVISOR_console_io(CONSOLEIO_write, - count, (char *)s)) > 0 ) - { - count -= rc; - s += rc; - } - else - break; + count -= rc; + s += rc; } } @@ -194,8 +189,8 @@ void xen_console_init(void) xc_mode = XC_SERIAL; kcons_info.write = kcons_write_dom0; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - if ( xc_mode == XC_SERIAL ) - kcons_info.flags |= CON_ENABLED; + if ( xc_mode == XC_SERIAL ) + kcons_info.flags |= CON_ENABLED; #endif } else @@ -209,14 +204,14 @@ void xen_console_init(void) { case XC_SERIAL: strcpy(kcons_info.name, "ttyS"); - if ( xc_num == -1 ) xc_num = 0; - break; + if ( xc_num == -1 ) xc_num = 0; + break; case XC_TTY: strcpy(kcons_info.name, "tty"); - if ( xc_num == -1 ) xc_num = 1; - break; - + if ( xc_num == -1 ) xc_num = 1; + break; + default: return __RETCODE; } @@ -261,7 +256,7 @@ void xencons_force_flush(void) * We use dangerous control-interface functions that require a quiescent * system and no interrupts. Try to ensure this with a global cli(). */ - local_irq_disable(); /* XXXsmp */ + local_irq_disable(); /* XXXsmp */ /* Spin until console data is flushed through to the domain controller. */ while ( (wc != wp) && !ctrl_if_transmitter_empty() ) @@ -502,8 +497,10 @@ static inline int __xencons_put_char(int ch) } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -static int xencons_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int xencons_write( + struct tty_struct *tty, + const unsigned char *buf, + int count) { int i; unsigned long flags; @@ -525,8 +522,11 @@ static int xencons_write(struct tty_struct *tty, const unsigned char *buf, return i; } #else -static int xencons_write(struct tty_struct *tty, int from_user, - const u_char *buf, int count) +static int xencons_write( + struct tty_struct *tty, + int from_user, + const u_char *buf, + int count) { int i; unsigned long flags; @@ -669,7 +669,7 @@ static int xennullcon_dummy(void) return 0; } -#define DUMMY (void *)xennullcon_dummy +#define DUMMY (void *)xennullcon_dummy /* * The console `switch' structure for the dummy console diff --git a/xen/common/physdev.c b/xen/common/physdev.c index 83dce4d4a7..a1f182e8c8 100644 --- a/xen/common/physdev.c +++ b/xen/common/physdev.c @@ -105,18 +105,12 @@ static int setup_ioport_memory_access(struct domain *d, struct pci_dev *pdev) return 0; } -void physdev_modify_ioport_access_range( struct domain *d, int enable, - int port, int num ) +void physdev_modify_ioport_access_range( + struct domain *d, int enable, int port, int num) { int i; - ASSERT( d->arch.iobmp_mask ); - for ( i = port; i < port+num; i++ ) - { - if(enable) - clear_bit(i, d->arch.iobmp_mask); - else - set_bit(i, d->arch.iobmp_mask); - } + for ( i = port; i < (port + num); i++ ) + (enable ? clear_bit : set_bit)(i, d->arch.iobmp_mask); } /* Add a device to a per-domain device-access list. */ diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c index e9eb6eff2f..8db47dc903 100644 --- a/xen/drivers/char/serial.c +++ b/xen/drivers/char/serial.c @@ -480,19 +480,12 @@ void serial_force_unlock(int handle) uart->lock = SPIN_LOCK_UNLOCKED; } -void serial_endboot() +void serial_endboot(void) { int i; - - for (i=0;i -void physdev_modify_ioport_access_range( struct domain *d, int enable, - int port, int num ); +void physdev_modify_ioport_access_range( + struct domain *d, int enable, int port, int num ); void physdev_destroy_state(struct domain *d); -int physdev_pci_access_modify(domid_t dom, int bus, int dev, int func, - int enable); +int physdev_pci_access_modify( + domid_t dom, int bus, int dev, int func, int enable); int domain_iomem_in_pfn(struct domain *p, unsigned long pfn); long do_physdev_op(physdev_op_t *uop); void physdev_init_dom0(struct domain *d); -- 2.30.2